package com.ojoin.trade.supplyloan_core.web.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.common.utils.TimeUtils;
import com.ojoin.trade.common.web.dao.BaseDao;
import com.ojoin.trade.common.web.service.impl.BaseServiceImpl;
import com.ojoin.trade.supplyloan_core.web.dao.TbSlLoanStatDayDao;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlLoanStatDay;
import com.ojoin.trade.supplyloan_core.web.service.TbSlLoanStatDayService;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 15-10-27
 * Time: 下午1:58
 * To change this template use File | Settings | File Templates.
 */

@Service
public class TbSlLoanStatDayServiceImpl extends BaseServiceImpl<TbSlLoanStatDay> implements TbSlLoanStatDayService {

    @Autowired

    private TbSlLoanStatDayDao dao ;
    @Override
    protected BaseDao<TbSlLoanStatDay> getBaseDao() {
        return dao;
    }

//    @Override
//    public void addTbSlLoanStatDayInfo(int idOfTbMerchantUser, String platformName, int idOfPlatformUser, String todayUnsettleInstoreorder, String todayUnenterinRefundorder, String todayUnpaySettleorder) throws BusinessException {
//        TbSlLoanStatDay statdayvo=new TbSlLoanStatDay();
//        statdayvo.setIdOfTbMerchantUser(idOfTbMerchantUser);
//        statdayvo.setPlatformName(platformName);
//        statdayvo.setIdOfPlatformUser(idOfPlatformUser);
//        statdayvo.setTodayUnenterinRefundorder(todayUnenterinRefundorder);
//        statdayvo.setTodayUnpaySettleorder(todayUnpaySettleorder);
//        statdayvo.setTodayUnsettleInstoreorder(todayUnsettleInstoreorder);
//        statdayvo.setStatDate(CommonUtils.getCurDate());
//        ((TbSlLoanStatDayDao)this.getBaseDao()).insertTbSlLoanStatDay(statdayvo);
//
//    }

    @Override
    public void insertTbSlLoanStatDayInfo(TbSlLoanStatDay statDayvo) throws BusinessException {
        ((TbSlLoanStatDayDao)this.getBaseDao()).insertTbSlLoanStatDay(statDayvo);
    }

    @Override
    public TbSlLoanStatDay queryTbSlLoanDayByJoinid(int joinid) throws BusinessException {
        return ((TbSlLoanStatDayDao)this.getBaseDao()).queryTbSlLoanStatDay(joinid,TimeUtils.getCurDate());
    }

	@Override
	public void deleteTbSlLoanDayByPlatformUserIDAndDate(int platformUserId,
			String statDate) throws BusinessException {
		((TbSlLoanStatDayDao)this.getBaseDao()).deleteTbSlLoanDayByPlatformUserIDAndDate(platformUserId, statDate);
	}

	@Override
	public List<TbSlLoanStatDay> queryByPlatformAndMerchantUserIDAndDate(String platformName,
			String merchantUserId, String statDate) throws BusinessException {
		 Map<String,Object> paramap=new HashMap<String, Object>();
	     paramap.put("platformName",platformName);    
	     paramap.put("merchantUserId",merchantUserId); 
	     paramap.put("statDate",statDate);      
	     List<TbSlLoanStatDay> li =  this.getBaseDao().selectList(paramap);

		return li;
		
	}
}
